<template>
    <!--添加合伙人弹框-->
    <el-dialog :visible="addDialog" :close-on-click-modal="false" :before-close="cancelDialog">
        <el-form :model="remarkInfoEntity" label-width="100px">
            <el-row>
                <el-form-item label="时间：">
                    <el-date-picker v-model="remarkInfoEntity.recordTime" type="date" placeholder="选择日期"></el-date-picker>
                </el-form-item>
            </el-row>
            <el-row>
                <el-form-item label="标题：">
                    <el-input v-model="remarkInfoEntity.title" :maxlength="100" placeholder="不超过100字"></el-input>
                </el-form-item>
            </el-row>
            <el-row>
                <el-form-item label="内容：">
                    <el-input v-model="remarkInfoEntity.content" :maxlength="3000" placeholder="不超过3000字" type="textarea" :rows="4"></el-input>
                </el-form-item>
            </el-row>
            <el-row>
                <el-form-item>
                    <el-row class="ca-m-b-20">
                        <div class="ca-inline-block ca-m-r-10 ">
                            <csUpload
                                :fileType="fileType"
                                :businessId="itemId"
                                :isShowFileChildType="false"
                                uploadType="all"
                                @getFileList="getPartnerDetail"
                                :getFileUploadedReturnData="getFileUploadedReturnDataFun"
                            ></csUpload>
                        </div>
                    </el-row>
                    <el-row class="ca-file-row" v-for="(file, editIndex) in fileDetail" :key="editIndex">
                        <el-col :span="2">
                            <tz-icon-file-type class="ca-m-r-5" :fileType="file.fileName"></tz-icon-file-type>
                        </el-col>
                        <el-col :span="10">
                            <div class="ca-text-over-flow-ellipsis ca-pointer">
                                <span class="ca-font-size-16 ca-pointer">{{file.fileName}}</span>
                            </div>
                        </el-col>
                        <el-col :span="3">
                            <el-button class="ca-table-btn" @click="deleteFileItem(editIndex)">
                                <i class="fa fa-times"></i>
                            </el-button>
                        </el-col>
                    </el-row>
                </el-form-item>
            </el-row>

        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="cancelDialog">取 消</el-button>
            <el-button type="primary" @click="addRemarkInfo">确 定</el-button>
        </div>
    </el-dialog>
</template>
<script type="text/ecmascript-6">
    export default {
        data() {
            return {
                itemId: this.$route.params.fundId,
                guest: this.$store.state.user.guest,
                fundPartnerOptionsAdd: this.$store.state.user.dictionaryMap.ansatLp,//弹框筛选
                fileType: '',//基金文件类型
            }
        },
        props: ['remarkInfoEntity', 'addDialog', 'fileDetail'],
        mounted() {
            let fileTypeList = this.$store.state.user.fileFloderDicVoList;
            fileTypeList.map(item=>{
                if (item.name === '管理记录') {
                    this.fileType = item.type;
                }
            })
        },
        methods: {
            // 取消
            cancelDialog() {
                this.$emit('cancelDialog')
            },
            // 添加
            addRemarkInfo() {
                this.$emit('addRemarkInfo')
            },
            // 文件成功返回的数据
            getFileUploadedReturnDataFun(arr) {
                this.$emit('getFileUploadedReturnDataFun', arr)
            },
            // 添加后获取详情
            getPartnerDetail() {
                this.$emit('getPartnerDetail')
            },
            // 删除添加时的文件
            deleteFileItem(index) {
                this.$emit('deleteFileItem', index)
            }
        },
        components: {
            'csUpload': require('__components/upload-btn/index'),//上传文件组件
        }
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

</style>
